TensorFlow - Keras

In this article, we go through basic image classification using Multi-layer Perceptron (MLP). For testing the algorithm, we use sklearn digit dataset.

Dataset

Train and Test Sets

Image Classification

The goal of this approach is to classify the images by focusing on the relationship between nearby pixels. A simple implementation of an image classifier can be performed in Keras using Multi-layer Perceptron (MLP) Image Classification as follows.

Let's define some function by which we can analyze the performance of the modeling.

Confusion Matrix

The confusion matrix allows for visualization of the performance of an algorithm. Note that due to the size of data, here we don't provide a Cross-validation evaluation. In general, this type of evaluation is preferred.

Predictions

For example, we can randomly pick an entry from the correctly predicted labels list

Similarly, from the wrongly predicted labels list


References

  1. scikit-learn digits dataset
  2. Keras developer guides
  3. Multilayer perceptron wikipedia page
  4. Confusion matrix wikipedia page